#include "stun_protocol/stun_protocol_attr.h"
#include "string_util/string_util.h"
#include <cstdint>
#include <cstdio>
#include <gtest/gtest.h>
#include <vector>


TEST(StunMappedAddressAttr, Parse)
{
    StunMappedAddressAttr attr   = {};
    std::string           packet = "002000080001106c1c8a6504";
    const char *          ptr    = packet.c_str();
    std::vector<uint8_t>  packet_data;
    StringUtil::HexStrToCharacter(ptr, packet_data);
    int length = 0;
    printf("packet data size : %ld.\n", packet_data.size());
    int status = attr.ParseBufferToAttr(packet_data.data() + 4, packet_data.size(), length);
    EXPECT_EQ(status, (int)StunAttr::EmParseStatus::EmParseSuccess);
}


